////////////////////////////////////////////////////////////
// Workfile : HtmlWriter.h
// Author : Thomas Pfeiffer
// Date : 31.10.2012
// Description : Implementation of the HtmlWriter 
//               Extends the Writer / implements the template method
////////////////////////////////////////////////////////////
#include "Address.h"
#include "Person.h"
#include "HtmlWriter.h"

void HtmlWriter::DoWrite( std::ostream & out, Address* addr, std::list<Person*> const& persons, bool WriteHeader ) const
{
	if (WriteHeader) {
		out << "<h1>Adressen mit zugeordneten personen</h1>" << std::endl << "<hr><br />" << std::endl;
	}

	out << "<i>" << addr->getTown() << "</i><br />\n<i>" << addr->getStreetAndNumber() << "</i><br />" << std::endl;

	out << "<ul>" << std::endl;
	std::list<Person*>::const_iterator it = persons.begin();
	for (; it != persons.end(); ++it) {
		out << "<li>" << (*it)->getName() << "</li>" << std::endl;	
	}
	out << "</ul>" << std::endl;
	out << std::endl;
}
